home *** CD-ROM | disk | FTP | other *** search
- > >Just a quick question here.
- > >
- > >I want to be able to use the RND() function to create random numbers, yet
- > >have those "random" numbers the same under certain circumstances. See, I
- > >want the user to be able to specify a "seed" number, so that inputting the
- > >same "seed" will provide the same results. Should I use RANDOMIZE SEED???
- >
- > No - that won't work (although it's supposed to - bug #153). You'll have
- > to use this random number routine:
-
- [routine deleted]
-
- >
- >
- > --Andy Church
- >
-
- Well, to those of you who require seedable random numbers, here is
- how you do it, without requiring you to write your own RND function.
-
- Simply use the AMOS RND function, but use a NEGATIVE
- number for the RND limit.
-
- Thus:
-
- For A = 1 to 10
- Randomise 42
- For B = 1 to 10
- Print Rnd(100)
- Next B
- Next A
-
- will produce 10 sets of different random numbers, thus proving that
- RND in this case ignores the reseeding via Randomise.
-
- However:
-
- For A = 1 to 10
- Randomise 42
- For B = 1 to 10
- Print Rnd(-100)
- Next B
- Next A
-
- will produce 10 sets of random numbers where each set has the
- SAME random numbers in the SAME sequence.
-
- Don`t thank me, thank Europress. They told me this workaround,
- about the only bit of help they were regarding AMOS though.......
-
- Hello 1995
-
- Chris
- c.j.coulson@ncl.ac.uk
- A4000 expanding nicely
-
-